package stub

import (
	"happy-go/microservice/rpc/proxy/handler"
	"net/rpc"
)

type ClickServiceStub struct {
	*rpc.Client
}

//NewClickServiceClient new click stub
func NewClickServiceClient(network, address string) ClickServiceStub {
	client, err := rpc.Dial(network, address)
	if err != nil {
		panic(err)
	}

	return ClickServiceStub{client}
}

//Click 与服务端方法保持一样
func (c *ClickServiceStub) Click(request string, replay *string) error {
	err := c.Call(handler.ClickServiceName+".Click", request, replay)
	if err != nil {
		return err
	}
	return nil
}
